<template>
  <div>
    <div>{{mes}}</div>
    <div v-show="sessType" class="btn" @click="toLookGroupDetails()"> 查看群组详情</div>
  </div>
</template>
<style lang="less" rel="stylesheet/less" scoped>
  .btn {
    width: 100px;
    height: 30px;
    border: 1px solid red;
    float: right;
  }
</style>
<script>
  import {checkStatus} from '../../assets/js/login';
  import Client from '../../assets/js/common';
import { Toast } from 'mint-ui';
import { Popup } from 'mint-ui';
import { Actionsheet } from 'mint-ui';
import { MessageBox } from 'mint-ui';
  export default {
    data () {
      return {
        mes: '发消息',
        loginInfo: {},
        myGroupData: null, // 我的群组项的详情
        sessType: false, // 设置group聊天类型
      }
    },
    mounted () {
      // 登录
      checkStatus((loginInfo) => {
      this.loginInfo = loginInfo;
      this.setSessType();

    });
    },
    methods: {
      test () {
        console.log('test');
      },

      setSessType() {
        let type = this.$route.query.sessType;
        if(type == "group"){
          this.sessType = true;
        }

      },

      toLookGroupDetails() {
        this.myGroupData = Client.getStore("ClickCurrentGroupData");
        let enrolleeRole =  this.myGroupData.RoleEn;
        let Id = this.myGroupData.GroupId;
        switch (enrolleeRole) {
          case 'Owner':
            this.$router.push({path: '/ownerGroupDetails',query: {"groupId": Id}});
            break;
          case 'Member':
            this.$router.push({path: '/memberGroupDetails',query: {"groupId": Id}});
            break;
          case 'Manager':
             this.$router.push({path: '/ownerGroupDetails',query: {"groupId": Id}});
             // this.$router.push({path: '/managerGroupDetails',query: {"groupId": Id}});
            break;

          default:
            break;
        }
      }
    }
  }

</script>

